<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
    <style>
        .del{
            cursor: pointer;
        }
    </style>
<title>订单列表</title>
<link rel="stylesheet" href="__CSS__/pintuer.css">
<link rel="stylesheet" href="__CSS__/admin.css">
<script src="__JS__/jquery.js"></script>
<script src="__JS__/jquery.min.js"></script>
<script src="__JS__/pintuer.js"></script>
</head>
<body>
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="goodAdd.html"> 添加内容</a> </li>
        <form action="" id="F" method="get">
        <li>搜索：</li>
        <li>
         	 推荐
          <label><input type="radio" name="recommended" value="2" <{eq name="recommended|default=2" value="2"}>checked<{/eq}> />  全部</label>
          <label><input type="radio" name="recommended" value="1" <{eq name="recommended|default=2" value="1"}>checked<{/eq}> />  是</label>
          <label><input type="radio" name="recommended" value="0" <{eq name="recommended|default=2" value="0"}>checked<{/eq}> />  否</label>
          	下架
            <label><input type="checkbox" <{in name="1" value="$if_show|default=[]"}>checked<{/in}> name="if_show[]" value="1" />是</label>
            <label><input type="checkbox" <{in name="0" value="$if_show|default=[]"}>checked<{/in}> name="if_show[]" value="0" />否</label>

       	 </li>

          <li>
          	<select name="cid" style="padding:5px 15px; border:1px solid #ddd;">
	            <option value="">请选择分类</option>
	            <{foreach $fl as $v}>
                      <{if 0 == $v['parent_id']}>
	            	<optgroup label="<{$v['cate_name']}>" >  </optgroup>
                        <{foreach $fl as $vv}>
                            <{if $vv['parent_id']==$v['cate_id']}>
                                <optgroup label="|-----<{$vv['cate_name']}>"></optgroup>
                                    <{foreach $fl as $vvv}>
                                        <{if $vvv['parent_id'] == $vv['cate_id']}>
                                             <option value="<{$vvv['cate_id']}>" <{eq name="cid|default=''" value="$vvv['cate_id']"}>selected<{/eq}> >|------------<{$vvv['cate_name']}></option>
                                          <{/if}>
                                      <{/foreach}>
                            <{/if}>
                          <{/foreach}>
                      <{/if}>
              	<{/foreach}>
          	</select>
          </li>
          <li>
            <input type="datetime-local" step="01" name="add_times" value="<{$add_times|default=''}>">最小
            <input type="datetime-local" step="01" name="add_timess" value="<{$add_timess|default=''}>">最大
          </li>
          <li>
              价格区间
            <input type="number" placeholder="请输入最小价格" name="prices" value="<{$prices|default=''}>">最小
            <input type="number" placeholder="请输入最大价格" name="pricess" value="<{$pricess|default=''}>">最大
          </li>
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="goods_name" value="<{$goods_name|default=''}>" class="input" style="width:200px; line-height:17px;display:inline-block" />
          <a href="javascript:F.submit();" class="button border-main icon-search" > 搜索</a></li>
      </ul>
      </form>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th width="15%">商品名称</th>
        <th>图片</th>
          <!--<th>商品简称</th>-->
        <th>价格</th>
        <th>品牌</th>
        <th>分类名称</th>
          <td><a href="<{:url('Spgl/goodList',$get,'')}>">注册时间</a><{$flag|default=''}></td>
        <th>推荐</th>
        <th>热门</th>
        <th>下架</th>
        <th width="310">操作</th>
      </tr>
        <{volist name="list" id="v" empty="$empty"}>
      <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" class="xuan" value="<{$v['goods_id']}>" /><{$v['goods_id']}></td>
          <td><{:str_replace(input('goods_name'),"<font color='red'><b>".input('goods_name')."</b></font>",$v['goods_name'])}></td>
          <td width="10%"><img src="__BRAND__/<{$v['default_image']}>" alt="" onerror="this.src='__IMAGES__/11.jpg'" width="70" height="50" /></td>
          <!--<td><{$v['goods_title']}></td>-->
          <td><{$v['price']}></td>
          <td><{$v['brand_name']}></td>
          <td><{$v['cate_name']}></td>
          <td><{$v['add_time']}></td>
          <td><img style="width: 20px; height: 20px;" src="__IMAGES__/<{$v['recommended']}>" alt=""></td>
          <td><img style="width: 20px; height: 20px;" src="__IMAGES__/<{$v['recom']}>" alt=""></td>
          <td><img style="width: 20px; height: 20px;" src="__IMAGES__/<{$v['if_show']}>" alt=""></td>
          <td><div class="button-group"> <a class="button border-main" href="<{:url('goodedit?id='.$v['goods_id'],input('get.'))}>"><span class="icon-edit"></span> 修改</a>
              <a class="button border-red" href="javascript:void(0)" onclick="del('<{$v[\'goods_id\']}>')"><span class="icon-trash-o del">删除</span> </a> </div></td>
        </tr>
   		 <{/volist}>
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
        <td colspan="9" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 排序</a> 操作：
          <select name="ishome" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeishome(this)">
            <option value="">首页</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
          <select name="isvouch" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeisvouch(this)">
            <option value="">推荐</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
          <select name="istop" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeistop(this)">
            <option value="">下架</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
        </td>
      </tr>
      <tr>
        <td colspan="9">
            <div class="pagelist">
                <!--<a href="">上一页</a>-->
                <!--<span class="current">1</span>-->
                <!--<a href="">2</a>-->
                <!--<a href="">3</a>-->
                <!--<a href="">下一页</a>-->
                <!--<a href="">尾页</a>-->

            </div>
            <{$list|raw}>
        </td>
      </tr>
    </table>
  </div>
<script type="text/javascript">
//搜索
function changesearch(){

}

//单个删除
function del(id) {
    if (confirm("确定加入回收站吗？")){
        location.href="<{:url('del?1=1')}>&del="+id;
    }
}
//批量删除
function DelSelect() {
    var Checkbox=false;
    $("input[name='id[]']").each(function () {
        if (this.checked==true){
            Checkbox=true;
        }
    });
    if (Checkbox){
        var t=confirm("确定加入回收站吗？");
        if (t==false) return false;
        var arr = "";
        $('.xuan').each(function (index,object) {
            if ($(object).prop("checked")){
                arr+=$(object).val()+",";
            }
        });
        arr=arr.substring(0,arr.length-1);
        location.href='del.html?del='+arr;
    }else{
        alert("选择要删除的内容");
        return false;
    }
}
//全选
$("#checkall").click(function(){
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除


//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


//批量首页显示
function changeishome(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}

//批量推荐
function changeisvouch(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){


		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}

//批量置顶
function changeistop(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}


//批量移动
function changecate(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){

		$("#listform").submit();
	}
	else{
		alert("请选择要操作的内容!");

		return false;
	}
}

//批量复制
function changecopy(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
		Checkbox=true;
	  }
	});
	if (Checkbox){
		var i = 0;
	    $("input[name='id[]']").each(function(){
	  		if (this.checked==true) {
				i++;
			}
	    });
		if(i>1){
	    	alert("只能选择一条信息!");
			$(o).find("option:first").prop("selected","selected");
		}else{

			$("#listform").submit();
		}
	}
	else{
		alert("请选择要复制的内容!");
		$(o).find("option:first").prop("selected","selected");
		return false;
	}
}

</script>
</body>
</html>